package com.kinyx.framework.utils;

import javax.util.XArrayList;

import org.junit.Assert;
import org.junit.Test;

import lombok.AllArgsConstructor;

@AllArgsConstructor
public class KStringUtils_Tester_underline2hump {

	@Test
	public void test() {
		Assert.assertEquals(null, KStringUtils.underline2hump(null));
		Assert.assertEquals(null, KStringUtils.underline2hump("null"));

		Assert.assertEquals("", KStringUtils.underline2hump(""));
		Assert.assertEquals(" ", KStringUtils.underline2hump(" "));

		Assert.assertEquals("fooBarQux", KStringUtils.underline2hump("FOO_BAR_QUX"));
		Assert.assertEquals("malformedUrlException", KStringUtils.underline2hump("MALFORMED_URL_EXCEPTION"));
		Assert.assertEquals("ioException", KStringUtils.underline2hump("IO_EXCEPTION"));
	}

	@Test
	public void test2() {
		new XArrayList<String>()//

				.xAdd(null)//
				.xAdd("null")//

				.xAdd("")//
				.xAdd(" ")//

				.xAdd("fooBarQux")//
				.xAdd("malformedUrlException")//
				.xAdd("ioException")//
				.xAdd(null)//
				.xAdd(null)//
				.xAdd(null)//
				.forEach(str -> {
					if ("null".equals(str)) {
						Assert.assertEquals(null, KStringUtils.underline2hump(KStringUtils.hump2underline(str)));
					} else {
						Assert.assertEquals(str, KStringUtils.underline2hump(KStringUtils.hump2underline(str)));
					}
				});
	}

}
